cars = ['bmw','audi','toyota','subaru']

for car in cars:
    if car == 'bmw':
        print(car.upper())
    else:
        print(car.title())

requested_topping = 'mushrooms'
if requested_topping != 'anchovies':
    print("Hold the anchovies!")

banned_users = ['andrew','carolina','david']
user = 'marie'
if user not in banned_users:
    print(f"{user.title()},you can post a response if you wish.")

#练习5-1
car = 'subaru'
print("Is car == 'subaru'? I predict True.")
print(car == 'subaru')

print("\nIs car == 'audi'? I predict False.")
print(car == 'audi')

#练习5-2
my_name = 'Yanzhe'
print("姓名是否正确")
print(my_name == 'Yanzhe')
print(my_name == 'yanzhe')
print(my_name.lower() == 'Yanzhe')
print(my_name.lower() == 'yanzhe')

print("=============")
num_0 = 50
print(num_0 == 50)
print(num_0 != 50)
print(num_0 >= 20)
print(num_0 <= 70)
print(num_0 > 20)
print(num_0 < 30)

num_1 = 30
num_2 = 80
print(num_1 >=20 and num_1 <= 40)
print(num_2 >=20 and num_2 <= 40)
print(num_1 >=20 or num_1 <=20)
print(num_2 >=90 or num_2 <=40)

cars = ['bmw','audi','subaru']
print('bmw' in cars)
print('toyota' in cars)


print("--------5-3-------")

age = 17
if age >= 18:
    print("You are old enough to vote!")
    print("Have you registered to vote yet?")
else:
    print("Sorry, you are too young to vote.")
    print("Please register to vote as soon as you turn 18!")

age = 12
if age < 4:
    print("Your admission cost is $0.")
elif age < 18:
    print("Your admission cost is $25.")
else:
    print("Your admission cost is $40.")

age = 12
if age < 4:
    price = 0
elif age < 18:
    price = 25
else:
    price = 40
print(f"Your admission cost is ${price}.")

age = 12
if age < 4:
    price = 0
elif age < 18:
    price = 25
elif age < 65:
    price = 40
else:
    price = 20

print(f"Your admission cost is ${price}.")

age = 12
if age < 4:
    price = 0
elif age < 18:
    price = 25
elif age < 65:
    price = 40
elif age >= 65:
    price = 20

print(f"Your admission cost is ${price}.")

#练习5-3/5-4
alien_color = 'yello'
if alien_color == 'green':
    print("get 5 point")
else:
    print("get 10 point")

alien_color = 'green'
if alien_color == 'green':
    print("get 5 point")

#5-5
alien_color = 'yellow'
if alien_color == 'green':
    print("get 5 point")
elif alien_color == 'yellow':
    print("get 10 point")
elif alien_color == 'red':
    print("get 15 point")

#5-6
age = 45
if age < 2:
    print("婴儿")
elif age < 4:
    print("幼儿")
elif age <13:
    print("儿童")
elif age <20:
    print("青少年")
elif age <65:
    print("成年人")
elif age>=65:
    print("老年人")

#5-7
favorite_fruits = ['bear','apple','orange']
if 'bear' in favorite_fruits:
    print("You really like bear!")
if 'apple' in favorite_fruits:
    print("You really like apple!")
if 'orange' in favorite_fruits:
    print("You really like orange!")

